{extend name="public/base"/}
{block name="body"}
<!-- datepicker statr -->
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/board/board.min.css">
<!-- datepicker end -->

<link rel="stylesheet" href="__PUBLIC__/plugs/tagsinput/bootstrap-tagsinput.css">
<script src="__PUBLIC__/plugs/tagsinput/bootstrap-tagsinput.js"></script>

<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/webuploader/webuploader.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/plugs/editor/css/simditor.css" />
<link rel="stylesheet" href="__PUBLIC__/plugs/editor/css/simditor-html.css" media="screen" charset="utf-8" />

<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/module.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/hotkeys.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/uploader.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/simditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/beautify-html.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/editor/js/simditor-html.js"></script>



<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>配置管理</h2>
		</div>
		<div class="pull-right">
			<a href="{:url('Config/index')}" class="btn btn-primary">
				<i class="fa fa-list"></i>
				配置列表
			</a>
			<a href="{:url('Config/add')}" class="btn btn-danger">
				<i class="fa fa-list"></i>
				添加配置
			</a>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<div class="tabs-wrapper">
			<ul class="nav nav-tabs">
				{volist name=":config('config_group_list')" id="item"}
				<li {if condition="$key eq $id"}class="active"{/if}>
					<a href="{:url('Config/group',array('id'=>$key))}">{$item}</a>
				</li>
				{/volist}
			</ul>
			<div class="tab-content">
				<div class="tab-pane fade in active" id="tab-home">
					<form method="post" class="form form-horizontal" role="form">
						{volist name="list" id="item"}
						<div class="form-group">
							<label for="inputEmail1" class="col-lg-2 control-label">{$item['title']}</label>
							<div class="col-lg-10">
								{switch name="item['type']"}
								{case value="text"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:50%;">
								{/case}
								{case value="num"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:30%;">
								{/case}
								{case value="string"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:80%;">
								{/case}
								{case value="textarea"}
								<textarea class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:80%; height:120px;">{$item['value']}</textarea>
								{/case}
								{case value="select"}
								<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
									{volist name=":parse_config_attr($item['extra'])" id="vo"}
									<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
									{/volist}
								</select>
								{/case}
								{case value="datetime"}
								<div class="input-group">
									<input type="text" class="form-control" id="{$item['name']}" name="config[{$item['name']}]" value="{$item['value']}" readonly size="15">
									<span class="input-group-addon"><i class="fa fa-th"></i></span>
								</div>
								<script>
								$('#{$item['name']}').fdatepicker({
									format: 'yyyy-mm-dd',

								});
								</script>
								{/case}
								{case value="bool"}
								<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
									{volist name=":parse_config_attr($item['extra'])" id="vo"}
									<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
									{/volist}
								</select>
								{/case}
								{case value="image"}
								<div class="picker-box">
									<div id="picker_{$item['name']}" class="picker_button">上传图片</div>
									{if isset($item['value']) && $item['value']}
									<input type="hidden" name="config[{$item['name']}]" id="field_{$item['name']}" value="{$item['value']}">
									{else/}
									<input type="hidden" name="config[{$item['name']}]" id="field_{$item['name']}" value="">
									{/if}
									<div id="fileList_{$item['name']}" class="upload-file-list-info" style="width:280px;">
										{if $item['value']}
										{php}
										$images = get_cover($item['value']);
										{/php}
										<li class="affix-list-item" id="WU_FILE_0">
											<div class="upload-file-info">
												<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$item['value']}" data-fileurl="{$images['path']}"><i class="close"></i></span>
												<span class="fname"></span>
												<span class="fsize">上传时间:{$images['create_time']|date='Y-m-d H:i:s',###}</span>
												<div class="clearfix"></div>
											</div>
											<div class="filebox image">
												<img src="{:config('base_url')}{$images['path']}" class="img-responsive">
											</div>
										</li>
										{/if}
									</div>
								</div>
								<script type="text/javascript">
									uploadsize =  2;
									$(function(){
										$("#picker_{$item['name']}").SentUploader({
												fileNumLimit:1,
												uploadEvents: {
													uploadComplete:function(file){}
												},
												listName : "fileList_{$item['name']}",
												hiddenName: "field_{$item['name']}",
												hiddenValType:1,
												fileSingleSizeLimit:uploadsize*1024*1024,
												closeX:true
											},
											{
												fileType: 'service',
												filename : 'images',
											});
									});
								</script>
								{/case}
								{/switch}
								{if condition="$item['remark']"}
								<span class="help-block">（{$item['remark']}）</span>
								{/if}
							</div>
						</div>
						{/volist}
						<div class="form-group">
							<div class="col-lg-offset-2 col-lg-10">
								<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
								<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>


<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/webuploader/webuploader.custom.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/droppable.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugs/board/board.min.js"></script>
{/block}
